/**
 *
 */
package com.clear.login.dao.ibatis;

import java.util.List;

import com.bis.common.entity.PermissionEntity;
import com.bis.framework.base.dao.ibatis.IbatisDaoSupport;
import com.bis.framework.entity.UserEntity;
import com.clear.login.dao.LoginDao;

public class LoginDaoImpl extends IbatisDaoSupport<UserEntity> implements LoginDao
{

    @Override
    public String getNameSpace()
    {
        return "Login.";
    }

    public UserEntity authenticate(UserEntity userEntity)
    {

        return (UserEntity) this.getSqlMapClientTemplate().queryForObject(getNameSpace() + "authenticate", userEntity);
    }

    public void updateUserPassword(UserEntity userEntity)
    {

    }

    public List<PermissionEntity> getUserPermission(UserEntity userEntity)
    {
        return this.getSqlMapClientTemplate().queryForList(getNameSpace() + "getUserPermission", userEntity);
    }

    public boolean checkUser(UserEntity userEntity)
    {
        int userCnt = (Integer) this.getSqlMapClientTemplate().queryForObject(getNameSpace() + "checkUser", userEntity);
        if (userCnt > 0)
        {
            return true;
        }
        return false;
    }
}